using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;

public class ItemData 
{
    [System.Serializable]
    public enum ItemType
    {
        [InspectorName("盾牌")]
        Shield,
        [InspectorName("武器")]
        Arms,
        [InspectorName("道具")]
        Tool,
        [InspectorName("护甲")]
        Armor,
        [InspectorName("裤子")]
        Pants,
        [InspectorName("手套")]
        Gloves,
        [InspectorName("鞋子")]
        Shoe,
        [InspectorName("头盔")]
        Helmet,
        [InspectorName("翅膀")]
        Wing,
        [InspectorName("材料")]
        Material,
        [InspectorName("蓝图")]
        Blueprint,
    }

    [System.Serializable]
    public class CraftMaterial
    {
        public int ItemID;      // 合成材料对应的物品ID
        public int Quantity;    // 材料数量

        // 无参构造，供 JsonUtility 反序列化使用
        public CraftMaterial() { }

        public CraftMaterial(int itemID, int quantity)
        {
            ItemID = itemID;
            Quantity = quantity;
        }
    }
    [System.Serializable]
    public enum Part
    {
        [InspectorName("左手")]
        LeftHand,

        [InspectorName("右手")]
        RightHand,
        [InspectorName("左或右手")]
        LeftOrRightHand,

        [InspectorName("左腿")]
        LeftLeg,

        [InspectorName("右腿")]
        RightLeg,

        [InspectorName("头颅")]
        Head,

        [InspectorName("躯干")]
        Torso,

        [InspectorName("脖子")]
        Neck,
    }
    
    
    [System.Serializable]
    public enum Target
    {
        [InspectorName("敌方")]
        Enemy,
        [InspectorName("友方")]
        Friends,
        [InspectorName("自身")]
        Self
    }
    [System.Serializable]
    public enum Distance
    {
        [InspectorName("近")]
        Close,
        [InspectorName("普通")]
        Usually,
        [InspectorName("远")]
        Far,
        [InspectorName("极远")]
        ExtremelyFar
    }
    [System.Serializable]
    public enum Quality
    {
        [InspectorName("白色")]
        White,
        [InspectorName("绿色")]
        green,
        [InspectorName("蓝色")]
        blue
        
    }
    [System.Serializable]
    public class Stat
    {
        public string StatName; // 词条名称
        public float Value; // 词条值
        public string Description; // 词条描述

        public Stat(string statName, float value, string description)
        {
            StatName = statName;
            Value = value;
            Description = description;
        }
    }

    

    [System.Serializable]
    public class Slot
    {
        public int Row; // 格子行
        public int Col; // 格子列
        public Item StoredItem; // 存放在格子中的物品，可能为空
        public int Quantity;   // 新增字段，记录数量

        public Slot(int row, int col)
        {
            Row = row;
            Col = col;
            StoredItem = null; // 初始时为空
            Quantity = 0;
        }
    }
    
    [System.Serializable]
    public class Backpack
    {
        public List<Slot> Slots = new List<Slot>(); // 背包中的所有格子

        public Backpack(int rows, int cols)
        {
            // 创建背包格子，初始化所有格子
            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    Slots.Add(new Slot(i, j));
                }
            }
        }

        // 获取某个位置的格子
        public Slot GetSlot(int row, int col)
        {
            return Slots.Find(slot => slot.Row == row && slot.Col == col);
        }
    }



}
